package com.example.controller.aboutProvince;

import com.example.vo.request.AdmissionScoreEditForm;
import com.example.vo.request.ProvinceConditionsDTO;
import com.example.permission.PermissionCheck;
import com.example.service.aboutProvince.CollegeMajorProvinceService;
import com.example.vo.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/province")
public class CollegeMajorProvinceController {

    @Resource
    private CollegeMajorProvinceService collegeMajorProvinceService;

    @PostMapping("/getProvinceEnrollment")
    @PermissionCheck(permissionPath = "/enrollmentProvince")
    public Result getProvinceEnrollment(@RequestBody ProvinceConditionsDTO provinceConditionsDTO) {
        return collegeMajorProvinceService.getProvinceEnrollment(provinceConditionsDTO);
    }

    @PostMapping("/updateProvinceAdmissionScore")
    @PermissionCheck(permissionPath = "/enrollmentProvince/operateProvinceList")
    public Result updateProvinceAdmissionScore(@RequestBody AdmissionScoreEditForm admissionScoreEditForm) {
        return collegeMajorProvinceService.updateProvinceAdmissionScore(admissionScoreEditForm);
    }

    @PostMapping("/editAdmissionScoreBatch")
    @PermissionCheck(permissionPath = "/enrollmentProvince/operateProvinceList")
    public Result editAdmissionScoreBatch(@RequestBody List<AdmissionScoreEditForm> admissionScoreEdits) {
        return collegeMajorProvinceService.editAdmissionScoreBatch(admissionScoreEdits);
    }

}
